package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.model.enums.ItemType;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.lease.model.entity.LabelInfo;
import com.atguigu.lease.web.admin.service.LabelInfoService;
import com.atguigu.lease.web.admin.mapper.LabelInfoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liubo
 * @description 针对表【label_info(标签信息表)】的数据库操作Service实现
 * @createDate 2023-07-24 15:48:00
 */
@Service
public class LabelInfoServiceImpl extends ServiceImpl<LabelInfoMapper, LabelInfo>
        implements LabelInfoService {

    @Override
    public List<LabelInfo> getByType(ItemType type) {
        QueryWrapper<LabelInfo> labelInfoQueryWrapper = new QueryWrapper<>();
        labelInfoQueryWrapper.eq(type != null, "type", type);
//        LambdaQueryWrapper<LabelInfo> labelInfoQueryWrapper = new LambdaQueryWrapper<>();
//        labelInfoQueryWrapper.eq(type!=null,LabelInfo::getType, type);
        List<LabelInfo> labelInfos = baseMapper.selectList(labelInfoQueryWrapper);
        return labelInfos;
    }
}




